Data traffic processing method, device, and system

ABSTRACT

This application provides a data traffic processing method, a device, and a system. The method includes: receiving, by a first network device on a first link, a first VXLAN packet sent by a second network device, where the first VXLAN packet includes a first sequence number and a first service packet; decapsulating, by the first network device, the first VXLAN packet; receiving, by the first network device on a second link, a second VXLAN packet sent by the second network device, where the second VXLAN packet includes a second sequence number and a second service packet; and when the first network device determines that the second sequence number is a next sequence number of the first sequence number, decapsulating, by the first network device, the second VXLAN packet.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2018/117989, filed on Nov. 28, 2018, which claims priority toChinese Patent Application No. 201810241895.6, filed on Mar. 22, 2018.The disclosures of the aforementioned applications are herebyincorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the field of communications technologies,and in particular, to a data traffic processing method, a device, and asystem.

BACKGROUND

A virtual extensible local area network (VXLAN) technology is atechnology that encapsulates a layer 2 packet by using a layer 3protocol. The VXLAN technology relates to a packet in a MAC-in-UDPformat. Specifically, an Ethernet frame based on a media access control(MAC) protocol is encapsulated in a user datagram protocol (UDP) packet.Further, the UDP packet is encapsulated in an internet protocol (IP)packet. The IP packet may be transmitted in a layer 3 network.Therefore, the Ethernet frame is transmitted in the layer 3 network. Inthe VXLAN technology, a VXLAN network identifier (VNI) is used toidentify a VXLAN network segment. Different VXLAN network segmentscorrespond to different VNIs, and the different VXLAN network segmentsare isolated from each other. Two virtual machines (VM) with a same VNImay directly communicate with each other. In other words, the two VMswith the same VNI communicate with each other without using a VXLANlayer 3 gateway (VXLAN L3 gateway). Two VMs with different VNIs need tocommunicate with each other by using the VXLAN layer 3 gateway. A VNIfield includes 24 bits. One management domain may include a maximum of2¹⁶ VXLAN network segments.

A VXLAN tunnel endpoint (VTEP) device is an edge device in a VXLAN. TheVTEP device transmits traffic of the VXLAN through a VXLAN tunnel, andthe VXLAN tunnel is a point-to-point logical tunnel between two VTEPdevices.

In actual application, the VXLAN tunnel may include one or a pluralityof links. When the VXLAN tunnel includes the plurality of links, a VTEPdevice used as a transmit end usually sends data traffic to a VTEPdevice used as a receive end in a per-flow load balancing manner.However, the per-flow load balancing manner may cause a relatively largedifference between bandwidth utilization of different links in theplurality of links. As a result, bandwidth utilization of the VXLANtunnel is low.

SUMMARY

In view of this, embodiments of this application provide a data trafficprocessing method, a device, and a system, to transmit data trafficthrough a VXLAN tunnel in a per-packet load balancing manner. This helpsincrease bandwidth utilization of the VXLAN tunnel.

Technical solutions provided in the embodiments of this application areas follows:

According to a first aspect, a data traffic processing method isprovided. The data traffic processing method is applied to a VXLAN, theVXLAN includes a first network device and a second network device, thefirst network device is connected to the second network device through aVXLAN tunnel, and the VXLAN tunnel includes a first link and a secondlink. The method includes: receiving, by the first network device on thefirst link, a first VXLAN packet sent by the second network device,where the first VXLAN packet includes a first sequence number and afirst service packet, and the first sequence number indicates a locationof the first service packet in a plurality of service packets;decapsulating, by the first network device, the first VXLAN packet;receiving, by the first network device on the second link, a secondVXLAN packet sent by the second network device, where the second VXLANpacket includes a second sequence number and a second service packet,and the second sequence number indicates a location of the secondservice packet in the plurality of service packets; after the firstnetwork device decapsulates the first VXLAN packet, determining, by thefirst network device, whether the second sequence number is a nextsequence number of the first sequence number; and when the first networkdevice determines that the second sequence number is the next sequencenumber of the first sequence number, decapsulating, by the first networkdevice, the second VXLAN packet.

Based on the solution provided in this embodiment, the first VXLANpacket is transmitted on the first link, and the second VXLAN packet istransmitted on the second link. The first VXLAN packet includes thefirst sequence number, and the second VXLAN packet includes the secondsequence number. Therefore, in the foregoing technical solution, trafficis transmitted in a per-packet load balancing manner. Compared with aper-flow load balancing manner, the technical solution provided in thisapplication helps lessen a difference between bandwidth utilization of afirst tunnel and bandwidth utilization of a second tunnel. Further, thishelps increase bandwidth utilization of the VXLAN tunnel.

In addition, the second sequence number is the next sequence number ofthe first sequence number, indicating that a time at which the firstnetwork device sends the first VXLAN packet is earlier than a time atwhich the first network device sends the second VXLAN packet. In thetechnical solution of this application, when the second sequence numberis the next sequence number of the first sequence number, regardless ofwhether the first VXLAN packet arrives at the first network devicebefore the second VXLAN packet or the first VXLAN packet arrives at thefirst network device after the second VXLAN packet, the first networkdevice decapsulates the first VXLAN packet before decapsulating thesecond VXLAN packet. Therefore, the first network device obtains thefirst service packet before obtaining the second service packet, so thatthe first network device can send the first service packet beforesending the second service packet. It is assumed that a sending VM needsto transmit the plurality of service packets to a receiving VM throughthe VXLAN. A time at which the sending VM sends the first service packetis earlier than a time at which the sending VM sends the second servicepacket. The second network device receives the first service packetbefore receiving the second service packet. The second network deviceseparately encapsulates the first service packet and the second servicepacket into the first VXLAN packet and the second VXLAN packet. Thesecond network device separately sends the first VXLAN packet and thesecond VXLAN packet to the first network device on the first link andthe second link. A sending time of the first VXLAN packet is earlierthan a sending time of the second VXLAN packet. Because congestiondegrees of the first link and the second link are different, a time atwhich the first VXLAN packet arrives at the first network device islater than a time at which the second VXLAN packet arrives at the firstnetwork device. A time at which the first network device decapsulatesthe first VXLAN packet based on the first sequence number is earlierthan a time at which the first network device decapsulates the secondVXLAN packet based on the second sequence number. Therefore, the firstnetwork device obtains the first service packet before obtaining thesecond service packet. Further, when sending the plurality of servicepackets to the receiving VM, the first network device may send the firstservice packet before sending the second service packet, so that asequence of receiving the plurality of service packets by the receivingVM is consistent with a sequence of sending the plurality of servicepackets by the sending VM. In this way, the foregoing technical solutionhelps reduce packet disorder.

In a possible implementation of the first aspect, the method furtherincludes: when the first network device determines that the secondsequence number is not the next sequence number of the first sequencenumber in the first VXLAN packet that has been decapsulated by the firstnetwork device, storing, by the first network device, the second VXLANpacket in a memory.

In another possible implementation of the first aspect, the methodfurther includes: determining, by the first network device, whether thememory stores a third VXLAN packet, where the third VXLAN packet is aVXLAN packet received by the first network device on the first link orthe second link, the third VXLAN packet includes a third sequence numberand a third service packet, the third sequence number indicates alocation of the third service packet in the plurality of servicepackets, and the third sequence number is a next sequence number of thefirst sequence number in the first VXLAN packet that has beendecapsulated by the first network device; and when the first networkdevice determines that the memory stores the third VXLAN packet,decapsulating, by the first network device, the third VXLAN packet.

In another possible implementation of the first aspect, the methodfurther includes: when residence time of a fourth VXLAN packet in thememory is greater than or equal to a first time threshold, determining,by the first network device, whether a value of a fourth sequence numberis less than a value of a sequence number included in another VXLANpacket stored in the memory, and determining, by the first networkdevice, whether the value of the fourth sequence number is greater thana value of the first sequence number in the first VXLAN packet that hasbeen decapsulated by the first network device, where the fourth VXLANpacket is a VXLAN packet received by the first network device on thefirst link or the second link, the fourth VXLAN packet includes thefourth sequence number and a fourth service packet, and the fourthsequence number indicates a location of the fourth service packet in theplurality of service packets; and when the first network devicedetermines that the value of the fourth sequence number is less than thevalue of the sequence number included in the another VXLAN packet storedin the memory, and the value of the fourth sequence number is greaterthan the value of the first sequence number in the first VXLAN packetthat has been decapsulated by the first network device, decapsulating,by the first network device, the fourth VXLAN packet.

In another possible implementation of the first aspect, the methodfurther includes: when residence time of a fourth VXLAN packet in thememory is greater than or equal to a first time threshold, determining,by the first network device, whether a value of a fourth sequence numberis greater than a value of a sequence number included in another VXLANpacket stored in the memory, where the fourth VXLAN packet is a VXLANpacket received by the first network device on the first link or thesecond link, the fourth VXLAN packet includes the fourth sequence numberand a fourth service packet, and the fourth sequence number indicates alocation of the fourth service packet in the plurality of servicepackets; and when the first network device determines that the value ofthe fourth sequence number is greater than the value of the sequencenumber included in the another VXLAN packet stored in the memory,resetting, by the first network device, the residence time of the fourthVXLAN packet in the memory, and re-counting the residence time of thefourth VXLAN packet in the memory.

In another possible implementation of the first aspect, the methodfurther includes: when residence time of a fourth VXLAN packet in thememory is greater than or equal to a first time threshold, determining,by the first network device, whether a value of a fourth sequence numberis less than a value of a sequence number included in another VXLANpacket stored in the memory, and determining, by the first networkdevice, whether an absolute value of a difference between the value ofthe fourth sequence number and a value of the first sequence number inthe first VXLAN packet that has been decapsulated by the first networkdevice is greater than a first sequence number threshold, where thefourth VXLAN packet is a VXLAN packet received by the first networkdevice on the first link or the second link, the fourth VXLAN packetincludes the fourth sequence number and a fourth service packet, thefourth sequence number indicates a location of the fourth service packetin the plurality of service packets, and a range of the first sequencenumber threshold is [0.5N, N], where N indicates an upper limit value ofa sequence number in a VXLAN packet sent by the second network device;and when the first network device determines that the value of thefourth sequence number is less than the value of the sequence numberincluded in the another VXLAN packet stored in the memory, and theabsolute value of the difference between the value of the fourthsequence number and the value of the first sequence number in the firstVXLAN packet that has been decapsulated by the first network device isgreater than the first sequence number threshold, decapsulating, by thefirst network device, the fourth VXLAN packet.

According to a second aspect, a data traffic processing method isprovided. The data traffic processing method is applied to a virtualextensible local area network VXLAN, the VXLAN includes a first networkdevice and a second network device, the first network device isconnected to the second network device through a VXLAN tunnel, and theVXLAN tunnel includes a first link and a second link. The methodincludes: receiving, by the second network device, a plurality ofservice packets from a virtual machine VM, where the plurality ofservice packets include a first service packet and a second servicepacket; generating, by the second network device, a first VXLAN packetbased on the first service packet, where the first VXLAN packet includesa first sequence number and the first service packet, and the firstsequence number indicates a location of the first service packet in theplurality of service packets; sending, by the second network device, thefirst VXLAN packet to the first network device on the first link;generating, by the second network device, a second VXLAN packet based onthe second service packet, where the second VXLAN packet includes asecond sequence number and the second service packet, the secondsequence number indicates a location of the second service packet in theplurality of service packets, and the second sequence number is a nextsequence number of the first sequence number; and after the secondnetwork device sends the first VXLAN packet to the first network deviceon the first link, sending, by the second network device, the secondVXLAN packet to the first network device on the second link.

Based on the solution provided in this embodiment, in the VXLAN, datatraffic is transmitted through the VXLAN tunnel in an ordered per-packetload balancing manner. This reduces packet disorder and increasesbandwidth utilization of the VXLAN tunnel.

In the first aspect or the second aspect, optionally, the first VXLANpacket includes a VXLAN header, and the VXLAN header includes the firstsequence number.

In the first aspect or the second aspect, optionally, the first VXLANpacket includes a generic network virtualization encapsulation GENEVEheader, the GENEVE header includes a sequence number type-length-valueTLV, and the sequence number TLV includes the first sequence number.

In the first aspect or the second aspect, optionally, the first VXLANpacket further includes an identifier of a first data flow, and thefirst data flow includes the plurality of service packets.

According to a third aspect, a first network device is provided. Thefirst network device has a function of implementing behaviors of thefirst network device in the foregoing methods. The function may beimplemented based on hardware, or may be implemented based on hardwareexecuting corresponding software. The hardware or the software includesone or more modules corresponding to the foregoing function.

In a possible design, a structure of the first network device includes aprocessor and an interface. The processor is configured to support thefirst network device in performing a corresponding function in theforegoing methods. The interface is configured to: support communicationbetween the first network device and a second network device; and sendinformation or an instruction in the foregoing methods to the secondnetwork device, or receive information or an instruction in theforegoing methods from the second network device. The first networkdevice may further include a memory. The memory is coupled to theprocessor, and the memory stores a program instruction and data that arenecessary for the first network device.

In another possible design, the first network device includes aprocessor, a transmitter, a receiver, a random access memory, aread-only memory, and a bus. The processor is coupled to thetransmitter, the receiver, the random access memory, and the read-onlymemory by using the bus. When the first network device needs to run, abootloader in a basic input/output system or an embedded system that isbuilt into the read-only memory is used to boot a system to start, andboot the first network device to enter a normal running state. After thefirst network device enters the normal running state, an applicationprogram and an operating system run in the random access memory, toenable the processor to perform the method in any one of the firstaspect or the possible implementations of the first aspect.

According to a fourth aspect, a first network device is provided. Thefirst network device includes a main control board and an interfaceboard, and may further include a switching board. The first networkdevice is configured to perform the method in any one of the firstaspect or the possible implementations of the first aspect.Specifically, the first network device includes modules configured toperform the method in any one of the first aspect or the possibleimplementations of the first aspect.

According to a fifth aspect, a first network device is provided. Thefirst network device includes a controller and a first forwardingsub-device. The first forwarding sub-device includes an interface board,and may further include a switching board. The first forwardingsub-device is configured to perform a function of the interface board inthe fourth aspect, and may further perform a function of the switchingboard in the fourth aspect. The controller includes a receiver, aprocessor, a transmitter, a random access memory, a read-only memory,and a bus. The processor is separately coupled to the receiver, thetransmitter, the random access memory, and the read-only memory by usingthe bus. When the controller needs to run, a bootloader in a basicinput/output system or an embedded system that is built into theread-only memory is used to boot a system to start, and boot thecontroller to enter a normal running state. After the controller entersthe normal running state, an application program and an operating systemrun in the random access memory, to enable the processor to perform afunction of the main control board in the fourth aspect.

According to a sixth aspect, a computer storage medium is provided andis configured to store a program, code, or an instruction used by theforegoing first network device, and when a processor or a hardwaredevice executes the program, the code, or the instruction, functions orsteps of the first network device in the foregoing aspects may becompleted.

According to a seventh aspect, a second network device is provided. Thesecond network device has a function of implementing behaviors of thesecond network device in the foregoing methods. The function may beimplemented based on hardware, or may be implemented based on hardwareexecuting corresponding software. The hardware or the software includesone or more modules corresponding to the foregoing function.

In a possible design, a structure of the second network device includesa processor and an interface. The processor is configured to support thesecond network device in performing a corresponding function in theforegoing methods. The interface is configured to: support communicationbetween the second network device and a first network device; and sendinformation or an instruction in the foregoing methods to the firstnetwork device, or receive information or an instruction in theforegoing methods from the first network device. The second networkdevice may further include a memory. The memory is coupled to theprocessor, and the memory stores a program instruction and data that arenecessary for the second network device.

In another possible design, the second network device includes aprocessor, a transmitter, a receiver, a random access memory, aread-only memory, and a bus. The processor is coupled to thetransmitter, the receiver, the random access memory, and the read-onlymemory by using the bus. When the second network device needs to run, abootloader in a basic input/output system or an embedded system that isbuilt into the read-only memory is used to boot a system to start, andboot the second network device to enter a normal running state. Afterthe second network device enters the normal running state, anapplication program and an operating system run in the random accessmemory, to enable the processor to perform the method in any one of thesecond aspect or the possible implementations of the second aspect.

According to an eighth aspect, a second network device is provided. Thesecond network device includes a main control board and an interfaceboard, and may further include a switching board. The second networkdevice is configured to perform the method in any one of the secondaspect or the possible implementations of the second aspect.Specifically, the second network device includes modules configured toperform the method in any one of the second aspect or the possibleimplementations of the second aspect.

According to a ninth aspect, a second network device is provided. Thesecond network device includes a controller and a second forwardingsub-device. The second forwarding sub-device includes an interfaceboard, and may further include a switching board. The second forwardingsub-device is configured to perform a function of the interface board inthe eighth aspect, and may further perform a function of the switchingboard in the eighth aspect. The controller includes a receiver, aprocessor, a transmitter, a random access memory, a read-only memory,and a bus. The processor is separately coupled to the receiver, thetransmitter, the random access memory, and the read-only memory by usingthe bus. When the controller needs to run, a bootloader in a basicinput/output system or an embedded system that is built into theread-only memory is used to boot a system to start, and boot thecontroller to enter a normal running state. After the controller entersthe normal running state, an application program and an operating systemrun in the random access memory, to enable the processor to perform afunction of the main control board in the eighth aspect.

According to a tenth aspect, a computer storage medium is provided andis configured to store a program, code, or an instruction used by theforegoing second network device, and when a processor or a hardwaredevice executes the program, the code, or the instruction, functions orsteps of the second network device in the foregoing aspects may becompleted.

According to an eleventh aspect, a network system is provided. Thenetwork system includes a first network device and a second networkdevice. The first network device is the first network device in thethird aspect, the fourth aspect, or the fifth aspect, and the secondnetwork device is the second network device in the seventh aspect, theeighth aspect, or the ninth aspect.

According to the foregoing solutions, the embodiments of thisapplication provide a data traffic processing method, a device, and asystem. The data traffic processing method, the device, and the systemare applied to a VXLAN scenario. The second network device transmits aplurality of VXLAN packets to the first network device on a plurality oflinks included in the VXLAN tunnel in the per-packet load balancingmanner, and loads carried in the plurality of VXLAN packets belong to asame data flow. Each of the plurality of VXLAN packets includes asequence number. Correspondingly, after receiving a VXLAN packet sent bythe second network device, the first network device processes the VXLANpacket based on a sequence number carried in the VXLAN packet and acurrent sequence number stored in the first network device. In this way,the sequence number is applied to transmission of the VXLAN packet, sothat data traffic is transmitted through the VXLAN tunnel in the orderedper-packet load balancing manner. This reduces packet disorder andincreases bandwidth utilization of the VXLAN tunnel.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of a structure of a network according toan embodiment of this application;

FIG. 2 is a schematic diagram of another structure of a networkaccording to an embodiment of this application;

FIG. 3 is a flowchart of a data traffic processing method according toan embodiment of this application;

FIG. 4 is a schematic diagram of an application scenario according to anembodiment of this application;

FIG. 5 is a format diagram of a VXLAN header according to an embodimentof this application;

FIG. 6 is a format diagram of a GENEVE header according to an embodimentof this application;

FIG. 7 is a format diagram of another GENEVE header according to anembodiment of this application;

FIG. 8 is a schematic structural diagram of a first network deviceaccording to an embodiment of this application;

FIG. 9 is a schematic diagram of a hardware structure of a first networkdevice according to an embodiment of this application;

FIG. 10 is a schematic diagram of a hardware structure of another firstnetwork device according to an embodiment of this application;

FIG. 11 is a schematic structural diagram of a second network deviceaccording to an embodiment of this application;

FIG. 12 is a schematic diagram of a hardware structure of a secondnetwork device according to an embodiment of this application; and

FIG. 13 is a schematic diagram of a hardware structure of another secondnetwork device according to an embodiment of this application.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

The following separately provides detailed descriptions by usingspecific embodiments.

FIG. 1 is a schematic diagram of a structure of a network according toan embodiment of this application. The network may be a virtualextensible local area network (VXLAN), and the network includes a firstnetwork device and a second network device. A communications networkbetween the first network device and the second network device may be anIP network. Specifically, the first network device communicates with thesecond network device on a first link, and the first network devicecommunicates with the second network device on a second link. The firstlink further includes a spine node 1, and the second link furtherincludes a spine node 2. Therefore, the second network device may senddata traffic to the first network device on the first link and the spinenode 1, and the second network device may alternatively send datatraffic to the first network device on the second link and the spinenode 2.

A VXLAN tunnel is established between the first network device and thesecond network device. The VXLAN tunnel includes the first link and thesecond link. The VXLAN tunnel is a logical tunnel between the firstnetwork device and the second network device. Specifically, the VXLANtunnel is a logical tunnel carried on IP links (the first link and thesecond link). To more vividly reflect association between the VXLANtunnel and the first link and the second link, the structure of thenetwork in FIG. 1 may be vividly presented as a structure of a networkshown in FIG. 2. FIG. 2 may be understood as a schematic diagram of astructure of a network, including the VXLAN tunnel, the first link, andthe second link but omitting the spine node 1 and the spine node 2. FIG.1 and FIG. 2 show that the VXLAN tunnel includes two links. It should beunderstood that the VXLAN tunnel may include more than two links, andall the links included in the VXLAN tunnel may be implemented based onstructures of the first link and the second link.

In an actual application scenario, the first network device and thesecond network device may be referred to as provider edge (PE) devices.Specifically, the first network device and the second network deviceeach may include a router or a layer 3 switch. In this embodiment ofthis application, the first network device and the second network deviceare respectively located at two ends of the VXLAN tunnel. Therefore, thefirst network device and the second network device may be referred to asVTEP devices. In a VXLAN application scenario, the VTEP device may alsobe referred to as a network virtualization edge (NVE) device. In someapplication scenarios, the VTEP device is understood as a moduleintegrated in the NVE device. In this application, without specialdescription, the VTEP device is equivalent to the NVE device.

The spine node 1 and the spine node 2 each may include a router or alayer 3 switch. The spine node 1 and the spine node 2 are configured toreceive traffic data from the first network device, and forward thetraffic data to the second network device. Alternatively, the spine node1 and the spine node 2 are configured to receive traffic data from thesecond network device, and forward the traffic data to the first networkdevice. The network structure shown in FIG. 1 may be applied to a datacenter (DC), to be specific, the DC includes a first network device anda second network device shown in FIG. 1. The first network device andthe second network device may communicate with a network node outsidethe DC on the spine node 1 and the spine node 2. In a possibleimplementation, there may further have another network device on thefirst link and/or the second link. For example, the first network devicecommunicates with the second network device on the first link, a thirdnetwork device, and the spine node 1. In another possibleimplementation, there is no network device on the first link and/or thesecond link. For example, as shown in FIG. 2, the first network deviceand the second network device directly communicate with each other onthe first link and the second link.

The first network device and the second network device each may beconnected to a VM. As shown in FIG. 1, the first network device isconnected to a VM 1 and a VM 2, and the second network device isconnected to a VM 3 and a VM 4. Therefore, the first network device mayreceive data traffic from the VM 1 or the VM 2, and forward the datatraffic to the second network device through the VXLAN tunnel.Alternatively, the first network device receives data traffic from thesecond network device through the VXLAN tunnel, and delivers the datatraffic to the VM 1 or the VM 2. Similarly, the second network devicemay perform a same operation, and details are not described herein. TheVM may be referred to as a host. Specifically, the VM may be a router ora switch. In addition, a quantity of VMs is not limited in thisapplication, and the first network device may be connected to aplurality of VMs. The VM may run on a server. One server may include atleast one VM. In a possible implementation, one server may include aplurality of VMs, and different VMs may belong to different VXLANnetwork segments.

In the network shown in FIG. 1, the VXLAN tunnel includes the first linkand the second link. The first link and the second link are used totransmit data traffic in a load balancing manner. In a subsequentembodiment of this application, an example in which the second networkdevice sends data traffic to the first network device is used fordescription. It should be understood that the first network device maysend data traffic to the second network device in a same implementation.

In the network shown in FIG. 1, the second network device may transmitdata traffic to the first network device on the first link and thesecond link in a per-flow load balancing manner. The per-flow loadbalancing manner refers to performing load balancing in a form of dataflows. The second network device receives a plurality of service packetssent by the VM 3 and the VM 4, where the plurality of service packetsbelong to a same data flow. The data flow is named a data flow 01. Thesecond network device receives the plurality of service packets from theVM 3 or the VM 4, and encapsulates each of the plurality of servicepackets into a VXLAN packet according to a VXLAN protocol. Therefore, inthis application, a VXLAN packet includes a service packet, and all theservice packets in the VXLAN packets belong to the data flow 01. Thesecond network device sends the plurality of VXLAN packet to the firstnetwork device on the first link. Because the per-flow load balancingmanner is used, the plurality of VXLAN packets are not shared on thesecond link for transmission. In other words, the plurality of servicepackets that belong to the data flow 01 are transmitted by the firstnetwork device to the second network device through only one link in theVXLAN tunnel. It is assumed that in this case, the second network devicefurther receives a plurality of service packets that are sent by the VM3 or the VM 4 and that belong to another data flow. The data flow isnamed a data flow 02. After receiving the plurality of service packetsthat belong to the data flow 02, the second network device encapsulates,in the per-flow load balancing manner, the plurality of service packetsthat belong to the data flow 02 into a plurality of VXLAN packets, andsends the plurality of VXLAN packets to the first network device on thesecond link. In the per-flow load balancing manner, service packets of asame data flow are transmitted on only one link, and therefore there isno packet disorder. However, this manner may cause a waste of bandwidthsof the VXLAN tunnel. For example, a data amount of the data flow 01transmitted on the first link is greater than a data amount of the dataflow 02 transmitted on the second link. In this way, after the data flow02 is transmitted on the second link, the data flow 01 is stilltransmitted on the first link. In this case, the second link is idle,thereby causing the waste of the bandwidths of the VXLAN tunnel.

In the network shown in FIG. 1, it is assumed that the second networkdevice transmits data traffic to the first network device on the firstlink and the second link in a per-packet load balancing manner. Theper-packet load balancing manner refers to performing load balancing ina form of packets. After receiving the plurality of service packets thatbelong to the data flow 01, the second network device encapsulates theplurality of service packets into the plurality of VXLAN packetsaccording to the VXLAN protocol. All the service packets included in theVXLAN packets belong to the data flow 01. The second network devicesends the plurality of VXLAN packets to the first network device on thefirst link in the per-packet load balancing manner. Service packets thatbelong to a same data flow are transmitted on two links. Because the twolinks have different bandwidths, delays, packet loss rates, and jitters,it cannot be ensured that the plurality of VXLAN packets are received bya VM connected to a receive end in an original sending sequence.Therefore, when the traditional per-packet load balancing manner isapplied to the VXLAN, packet disorder occurs.

The embodiments of this application provide a data traffic processingmethod, a device, and a system, to transmit data traffic through a VXLANtunnel in an ordered per-packet load balancing manner. This reducespacket disorder and increases bandwidth utilization of the VXLAN tunnel.As shown in FIG. 1, the second network device transmits the plurality ofVXLAN packets to the first network device on the first link and thesecond link in the per-packet load balancing manner, and the servicepackets carried in the plurality of VXLAN packets belong to a same dataflow. Each of the plurality of VXLAN packets includes a sequence number,and the sequence number is used to indicate a location, in the pluralityof service packets, of a service packet carried in each of the pluralityof VXLAN packets. After receiving a VXLAN packet sent by the secondnetwork device, the first network device processes the VXLAN packetbased on a sequence number carried in the VXLAN packet and a sequencenumber of a latest decapsulated VXLAN packet in the first networkdevice. A service packet carried in the VXLAN packet and a servicepacket carried in the latest decapsulated VXLAN packet belong to a samedata flow. The same data flow includes the plurality of service packets.For example, the same data flow may be a data flow sent by one VM toanother VM. For example, a data flow sent by a VM 0 to the VM 1 is onedata flow, and a data flow sent by the VM 0 to the VM 2 is another dataflow. For another example, when the data flow sent by one VM to anotherVM includes data flows of different types, the same data flow may bedata flows of a type. For example, the data flow sent by the VM 0 to theVM 1 includes a voice flow and a video flow. The voice flow sent by theVM 0 to the VM 1 is one data flow, and the video flow sent by the VM 0to the VM 1 is another data flow.

For example, the first network device has decapsulated a VXLAN packet01, and the VXLAN packet 01 is a latest decapsulated VXLAN packet of thefirst network device. After receiving a VXLAN packet 02, the firstnetwork device processes the VXLAN packet 02 based on a sequence numberincluded in the VXLAN packet 02 and a sequence number included in theVXLAN packet 01. A service packet included in the VXLAN packet 02 and aservice packet included in the VXLAN packet 01 belong to a same dataflow.

Correspondingly, in the VXLAN, for an implementation in which the firstnetwork device and the second network device transmit a data flow byusing sequence numbers in the per-packet load balancing manner, refer todescriptions of subsequent implementations.

FIG. 3 is a flowchart of a data traffic processing method according toan embodiment of this application. The method shown in FIG. 3 may beapplied to the network structure shown in FIG. 1 or FIG. 2.Specifically, the data traffic processing method is applied to a VXLAN,the VXLAN includes a first network device and a second network device,the first network device is connected to the second network devicethrough a VXLAN tunnel, and the VXLAN tunnel includes a first link and asecond link. The method includes the following steps.

S101: The second network device receives a plurality of service packetsfrom a VM, where the plurality of service packets include a firstservice packet and a second service packet.

In this embodiment of this application, an example in which the secondnetwork device sends data traffic to the first network device throughthe VXLAN tunnel is used for description. As shown in FIG. 1, the secondnetwork device receives the plurality of service packets from the VM 3or the VM 4, and the plurality of service packets are expected to besent to the VM 1 or the VM 2 connected to the first network device. Theplurality of service packets belong to a same data flow. The pluralityof service packets include the first service packet and the secondservice packet. For ease of description, in this embodiment of thisapplication, the VM 3 is used as a source end and the VM 1 is used as adestination end for description. Correspondingly, in this embodiment ofthis application, the data flow to which the plurality of servicepackets belong are named the data flow 01. Therefore, a source MACaddress of the data flow 01 is a MAC address of the VM 3, and adestination MAC address of the data flow 01 is a MAC address of the VM1. A source IP address of the data flow 01 is an IP address of the VM 3,and a destination IP address is an IP address of the VM 1. The data flow01 includes the plurality of service packets. A type definition of thedata flow 01 is not limited in this application. In a possibleimplementation, a type of the data flow 01 may be defined based on adestination address. For example, data traffic whose destination is theVM 1 belongs to the data flow 01. In another possible implementation, atype of the data flow 01 may be defined based on a service type. Forexample, the video traffic belongs to the data flow 01 or the voicetraffic belongs to the data flow 01.

S102: The second network device generates a first VXLAN packet based onthe first service packet, where the first VXLAN packet includes a firstsequence number and the first service packet, and the first sequencenumber indicates a location of the first service packet in the pluralityof service packets.

After receiving the plurality of service packets from the VM 3, thesecond network device performs VXLAN encapsulation on the plurality ofservice packets according to the VXLAN protocol. Specifically, thesecond network device encapsulates, according to the VXLAN protocol,each of the plurality of service packets that belong to the data flow 01into the VXLAN packet, to generate the plurality of VXLAN packets. Eachof the plurality of VXLAN packets includes a payload, and the payloadincludes the service packet. Therefore, all the service packets carriedin the plurality of VXLAN packets belong to the data flow 01.

In this embodiment of this application, after the second network devicereceives the first service packet, the second network device generatesthe first VXLAN packet based on the first service packet. The firstVXLAN packet includes a VXLAN header, the VXLAN header includes a VNI,and the VNI is used to identify a VXLAN network segment. In thisembodiment of this application, for ease of description, it is assumedthat the VM 3 and the VM 1 belong to a same VXLAN network segment. Forexample, a value of each VNI is VNI_10. The first VXLAN packet furtherincludes a source VTEP address and a destination VTEP address. Thesource VTEP address is a VTEP address of the second network device, andthe destination VTEP address is a VTEP address of the first networkdevice. The VTEP address includes an IP address. The source VTEP addressand the destination VTEP address ensure that the first VXLAN packet canbe transmitted through the VXLAN tunnel between the second networkdevice and the first network device.

In this embodiment of this application, the first VXLAN packet furtherincludes the first sequence number and the first service packet. Thefirst sequence number is used to indicate, in the plurality of servicepackets, the location of the first service packet carried in the firstVXLAN packet. To be specific, the first sequence number indicates, inthe data flow 01, a location of the first service packet encapsulated inthe first VXLAN packet. For example, a start value of a sequence numberis 1, and a first step value of the sequence number is 1. If a value ofthe first sequence number is 5, it indicates that the first servicepacket encapsulated in the first VXLAN packet is a fifth service packetin the data flow 01.

Optionally, the second network device stores a current sequence number.To distinguish a subsequently mentioned current sequence number storedin the first network device, the current sequence number stored in thesecond network device is referred to as a first current sequence number.A value of the first current sequence number indicates a value of asequence number used when the second network device encapsulates acurrent VXLAN packet. For example, if the value of the first currentsequence number is 5, a value of a sequence number carried in a VXLANpacket encapsulated by the second network device is 5. Afterencapsulating the VXLAN packet whose sequence number is 5, the secondnetwork device automatically adds a first step to the first currentsequence number, so that the first current sequence number is used toencapsulate a next VXLAN packet. For example, the first step is 1. Afterencapsulating the VXLAN packet whose sequence number is 5, the secondnetwork device automatically updates the value of the first currentsequence number to 6, so that the second network device encapsulates aVXLAN packet whose sequence number is 6. An initial value of thesequence number and a value of the first step are not limited in thisapplication, and may be, for example, any positive integer.

In a possible implementation, the first sequence number is carried inthe VXLAN header of the first VXLAN packet. As shown in FIG. 5, theVXLAN header includes a sequence number field, and the sequence numberfield is used to carry the first sequence number. The VXLAN headerfurther includes an enable flag bit, and when the enable flag bit is setto 1, it indicates that the sequence number field is valid. “S” shown inFIG. 5 is used to implement the enable flag bit.

In another possible implementation, an encapsulation format of the firstVXLAN packet may be alternatively encapsulation performed based on ageneric network virtualization encapsulation (GENEVE) protocol.Specifically, the first VXLAN packet includes a GENEVE header. A formatof the GENEVE header may be implemented in a manner shown in FIG. 6. TheGENEVE header includes a version field, an options length field, aprotocol type field, a flag bit (O and C), a VNI field, and a reservedfield. For definitions of the foregoing fields, refer to relateddescriptions of the Internet Engineering Task Force (IETF) working groupdraft: draft-ietf-nvo3-geneve.

As shown in FIG. 6, the GENEVE header further includes a sequence numbertype-length-value (TLV), and the sequence number TLV is used to carry asequence number. Specifically, the sequence number TLV may include anoptions class field, a type field, a length field, a flag bit (R, R, R),and the sequence number field. The options class field is used toindicate an optional type of a GENEVE. In this embodiment of thisapplication, the options class field may be used to indicate that a TLVis the sequence number TLV, the type field is used to indicate a dataformat included in the sequence number TLV, and the length field is usedto indicate a length of the sequence number TLV. The flag bit is areserved control bit. The flag bit may be used for an enable sequencenumber field. For example, when a bit in the flag bit is set to 1, itindicates that the sequence number field is valid. The sequence numberfield is used to carry a value of a sequence number.

In this embodiment of this application, one data flow (the data flow oi)is used as an example for description. It should be understood that aplurality of data flows may be transmitted according to the method inthis embodiment of this application. When the plurality of data flowsare transmitted, the first VXLAN packet may carry an identifier of thedata flow, and the identifier is used to identify the data flow. In thisembodiment of this application, the identifier of the data flow may bereferred to as a flow identifier.

In a possible implementation, the first VXLAN packet includes the VXLANheader (as shown in FIG. 5). When generating the first VXLAN packet, thesecond network device may perform Hash calculation on trafficinformation of an inner packet of the first VXLAN packet, and use aresult of the Hash calculation as the flow identifier. The trafficinformation of the inner packet of the first VXLAN packet is trafficinformation of a payload of the first VXLAN packet, in other words, thetraffic information of the first service packet. The traffic informationmay include one or more of the following information: a source IPaddress, a destination IP address, a source port number, a destinationport number, and a transmission protocol. The second network device addsthe result of the Hash calculation to a UDP header of the first VXLANpacket, and adds the result of the Hash calculation to a source portfield in the UDP header. In this way, the UDP header is used in thisembodiment of this application. On one hand, the UDP header is used toindicate the source port number. On the other hand, the UDP header isused to indicate a data flow to which the first service packet belongs.

In another possible implementation, the first VXLAN packet includes theVXLAN header (as shown in FIG. 6). The second network device maycalculate traffic information of an inner packet of the first VXLANpacket by using a Hash algorithm in the same manner. Then, the secondnetwork device uses a result of hash calculation as the flow identifier,and adds the flow identifier to a sequence number TLV in a GENEVEheader, as shown in FIG. 7. A difference between the format of theGENEVE header shown in FIG. 6 and a format of the GENEVE header shown inFIG. 7 lies in that a flow identifier field is added. The flowidentifier field is used to carry a flow identifier of a data flow towhich the first service packet in the first VXLAN packet belongs. Inaddition, any bit in a flag bit in FIG. 7 may be used to indicatewhether the flow identifier field is valid.

S103: The second network device sends the first VXLAN packet to thefirst network device on the first link.

S104: The first network device receives the first VXLAN packet sent bythe second network device on the first link.

After generating the first VXLAN packet, the second network device maysend the first VXLAN packet to the first network device through theVXLAN tunnel. Specifically, the second network device may send the firstVXLAN packet on the first link or the second link included in the VXLANtunnel. In this embodiment of this application, an example in which thesecond network device sends the first VXLAN packet on the first link isused for description. Correspondingly, the first network device receivesthe first VXLAN packet on the first link.

S105: The first network device decapsulates the first VXLAN packet.

After obtaining the first VXLAN packet, the first network device mayprocess the first VXLAN packet based on the first sequence numbercarried in the first VXLAN packet. Specifically, the first networkdevice determines, based on the first sequence number, whether todecapsulate the first VXLAN packet. For a process in which the firstnetwork device processes the first VXLAN packet based on the firstsequence number, refer to descriptions of a second VXLAN packet insubsequent implementations of this application.

In an implementation of this application, it is assumed that the firstnetwork device determines, based on the first sequence number, todecapsulate the first VXLAN packet. In a possible implementation, thefirst service packet included in the first VXLAN packet is the firstservice packet in the plurality of service packets. For example, thefirst service packet is an initial packet of the data flow 01. The firstnetwork device decapsulates the first VXLAN packet. In another possibleimplementation, the first sequence number carried in the first VXLANpacket is a next sequence number of a sequence number included in aVXLAN packet that has been parsed by the first network device. Forexample, a value of a sequence number included in a VXLAN packet thathas been currently parsed by the first network device is 5, and a valueof the first sequence number carried in the first VXLAN packet is 6.Therefore, the first sequence number is a next sequence number of asequence number whose value is 5, and the first network devicedecapsulates the first VXLAN packet.

S106: The second network device generates the second VXLAN packet basedon the second service packet, where the second VXLAN packet includes asecond sequence number and the second service packet, the secondsequence number indicates a location of the second service packet in theplurality of service packets, and the second sequence number is a nextsequence number of the first sequence number.

In this embodiment of this application, the second network devicefurther receives a second service packet from the VM 3, where the secondservice packet is one of the plurality of service packets. To bespecific, both the first service packet and the second service packetbelong to the data flow 01. In an implementation of this application,the second service packet is a next service packet of the first servicepacket. After the second network device receives the second servicepacket, the second network device generates the second VXLAN packetbased on the second service packet. For an implementation in which thesecond network device generates the second VXLAN packet, refer to theforegoing implementation in which the second network device generatesthe first VXLAN packet. Details are not described herein.

The second sequence number carried in the second VXLAN packet is thenext sequence number of the first sequence number carried in the firstVXLAN packet. That is, the first sequence number and the second sequencenumber are consecutive sequence numbers. For example, if the value ofthe first sequence number is 5 and a sequence number step value is 1, avalue of the second sequence number is 6. Alternatively, if the value ofthe first sequence number is 5 and a sequence number step value is 2, avalue of the second sequence number is 7.

For example, according to the descriptions of S102, after the secondnetwork device generates the first VXLAN packet, the second networkdevice further adds the value of the first current sequence number bythe value of the first step. In other words, before generating the nextVXLAN packet (for example, the second VXLAN packet) of the first VXLANpacket, the second network device updates the value of the first currentsequence number. In addition, a specific value of the first step may bedetermined through negotiation between the first network device and thesecond network device. Alternatively, the second network devicedetermines the value of the first step, and notifies the first networkdevice. Alternatively, a network administrator directly sets the valueof the first step on the first network device and the second networkdevice. Alternatively, a default value (for example, a default value ofthe first step is 1) of the first network device and the second networkdevice is directly used. Optionally, a value of a sequence number of thefirst VXLAN packet of the data flow 01 sent by the second network deviceis set to the value of the first step.

S107: After the second network device sends the first VXLAN packet tothe first network device on the first link, the second network devicesends the second VXLAN packet to the first network device on the secondlink.

S108: The first network device receives the second VXLAN packet sent bythe second network device on the second link.

According to the foregoing descriptions of the implementation of thisapplication, the first VXLAN packet includes the first service packet,and the second VXLAN packet includes the second service packet. Thefirst service packet and the second service packet belong to a same dataflow, for example, the data flow 01. The first VXLAN packet and thesecond VXLAN packet are transmitted on different links, so that aplurality of VXLAN packets are sent on the first link and the secondlink in the per-packet load balancing manner. The first VXLAN packetfurther includes the first sequence number, and the second VXLAN packetfurther includes the second sequence number, to ensure that the firstnetwork device processes VXLAN packets based on sequence numbers whenreceiving the different VXLAN packets from a same data flow.

In an application scenario, the second network device generates theplurality of VXLAN packets based on the received plurality of servicepackets, and sends the plurality of VXLAN packets on the first link andthe second link in the per-packet load balancing manner. The followinguses FIG. 4 as an example to describe an implementation in which thesecond network device sends a VXLAN packet. Compared with the networkstructure shown in FIG. 1, specific implementation of VXLAN packettransmission is added in FIG. 4.

As shown in FIG. 4, a block 1 to a block 4 displayed on the first linkand the second link indicate four VXLAN packets, numbers in the blocksindicate sequence numbers of the VXLAN packets, and the four VXLANpackets all belong to the data flow oi. It should be understood thateach of the first VXLAN packet and the second VXLAN packet in thisembodiment of this application may be any VXLAN packet in the four VXLANpackets shown in FIG. 4. For ease of description, the four VXLAN packetsshown in FIG. 4 are respectively referred to as a VXLAN packet 01, aVXLAN packet 02, a VXLAN packet 03, and a VXLAN packet 04. A number in aname corresponds to a corresponding sequence number. In this embodimentof this application, for example, the first step is set to 1, and aninitial value of the first current sequence number is 1.

According to the description of the foregoing implementation, afterreceiving the plurality of service packets, the second network deviceencapsulates the first service packet in the plurality of servicepackets into the VXLAN packet 01. The data flow 01 includes theplurality of service packets. The value of the first current sequencenumber is 1, and therefore a sequence number carried in the VXLAN packet01 is 1. The second network device determines, through hash calculation,to send the VXLAN packet 01 on the first link. In addition, the secondnetwork device increases the first current sequence number by the firststep, that is, updates the value of the first current sequence numberfrom 1 to 2. Then, the second network device encapsulates the secondservice packet in the data flow 01 into the VXLAN packet 02. The valueof the first current sequence number has been updated to 2, andtherefore a sequence number carried in the VXLAN packet 02 is 2. Thesecond network device determines, through hash calculation, to send theVXLAN packet 02 on the second link. In addition, the value of the firstcurrent sequence number continues to be updated from 2 to 3. In sameimplementations, the second network device sends the VXLAN packet 03 andthe VXLAN packet 04 to the first network device. Therefore, the secondnetwork device may insert a sequence number into a VXLAN packet, toimplement load balancing transmission of service packets in the dataflow 01 on different links in the VXLAN tunnel. According to thedescription of the foregoing implementation, the VXLAN packet may carrya flow identifier, to distinguish different data flows. Therefore, thesecond network device may simultaneously send different data flows, andsequence numbers of the different data flows may overlap.

S109: After the first network device decapsulates the first VXLANpacket, the first network device determines whether the second sequencenumber is a next sequence number of the first sequence number.

S110: When the first network device determines that the second sequencenumber is the next sequence number of the first sequence number, thefirst network device decapsulates the second VXLAN packet.

To distinguish the current sequence number stored in the second networkdevice, the current sequence number stored in the first network deviceis referred to as a second current sequence number. After receiving thesecond VXLAN packet, the first network device obtains the secondsequence number carried in the second VXLAN packet. Then, the firstnetwork device processes the second VXLAN packet based on the secondsequence number and the second current sequence number. The secondcurrent sequence number is a sequence number of a VXLAN packet that isin the data flow and that is latest decapsulated by the first networkdevice. The VXLAN packet that is in the data flow and that is latestdecapsulated is a previous VXLAN packet that is of the second VXLANpacket and that is received by the first network device. Both theprevious VXLAN packet and the second VXLAN packet belong to the dataflow 01, and the previous VXLAN packet is successfully decapsulated bythe first network device. According to the foregoing implementation ofthis application, the previous VXLAN packet may be the first VXLANpacket, and the second current sequence number is the first sequencenumber. Processing, by the first network device, the second VXLAN packetmay include: decapsulating the second VXLAN packet, and forwarding thesecond service packet included in the second VXLAN packet, or cachingthe second VXLAN packet. Specifically, the first network devicedetermines whether the second sequence number is consecutive to thesecond current sequence number. In other words, the first network devicedetermines whether the second sequence number is the next sequencenumber of the first sequence number. Optionally, when the first networkdevice determines that the second sequence number is the next sequencenumber of the first sequence number, the first network devicedecapsulates the second VXLAN packet, and forwards a decapsulated secondservice packet to the destination end. When determining that the secondsequence number is not the next sequence number of the first sequencenumber, the first network device caches the second VXLAN packet into amemory of the first network device.

FIG. 4 is still used as an example for description. It is assumed thatan initial value of the second current sequence number is 0, and thevalue of the first step is 1. It is assumed that the first networkdevice first receives the VXLAN packet 01. The first network devicedetermines that the sequence number of the VXLAN packet 01 is 1, and thefirst network device determines that a value of the second currentsequence number is 0. Therefore, the first network device may determinethat the sequence number of the VXLAN packet 01 is consecutive to thesecond current sequence number. The first network device decapsulatesthe VXLAN packet 01 based on a determining result, and forwards aservice packet included in the VXLAN packet 01. In this way, the firstnetwork device may determine that the VXLAN packet 01 is a VXLAN packetthat is in the data flow 01 and that is latest decapsulated. Therefore,the first network device updates the second current sequence number to avalue of the sequence number of the VXLAN packet 01. If the next VXLANpacket received by the first network device is the VXLAN packet 02, thefirst network device may process the VXLAN packet 02 in a sameprocessing manner.

It is assumed that after the VXLAN packet 01 is received, the next VXLANpacket received by the first network device is the VXLAN packet 03. Thefirst network device determines that a sequence number of the VXLANpacket 03 is 3, and the first network device determines that the valueof the second current sequence number is 1. Therefore, the first networkdevice may determine that the sequence number of the VXLAN packet 03 isnot consecutive to the second current sequence number. In other words,the sequence number of VXLAN packet 03 is not the next sequence numberof the sequence number of the VXLAN packet 01. The first network devicecaches the VXLAN packet 03 based on a determining result. In addition,the VXLAN packet 03 is not the VXLAN packet that is in the data flow 01and that is latest decapsulated by the first network device. Therefore,the first network device does not update the second current sequencenumber to a value of the sequence number of the VXLAN packet 03.Optionally, after the first network device receives the VXLAN packet 02and successfully decapsulates the VXLAN packet 02, the first networkdevice decapsulates the cached VXLAN packet 03.

According to the description of the foregoing implementation, whenreceiving VXLAN packets of different data flows, the first networkdevice may identify, based on flow identifiers, data flows to which theVXLAN packets belong, to process a plurality of data flows according tothe foregoing method.

A plurality of links included in the VXLAN tunnel may be referred to asequal-cost multi-path (ECMP) links. The ECMP may also be expressed asequal cost multi-path. As shown in FIG. 1, the ECMP links include thefirst link and the second link.

According to the data traffic processing method provided in thisembodiment, the second network device transmits a plurality of VXLANpackets to the first network device on the plurality of links includedin the VXLAN tunnel in the per-packet load balancing manner, and loadscarried in the plurality of VXLAN packets belong to a same data flow.Each of the plurality of VXLAN packets includes a sequence number.Correspondingly, after receiving a VXLAN packet sent by the secondnetwork device, the first network device processes the VXLAN packetbased on a sequence number carried in the VXLAN packet and a currentsequence number stored in the first network device. According to themethod provided in this embodiment, the sequence number is applied totransmission of the VXLAN packet, so that data traffic is transmittedthrough the VXLAN tunnel in the ordered per-packet load balancingmanner. This reduces packet disorder and increases bandwidth utilizationof the VXLAN tunnel.

Optionally, when the first network device determines that the secondsequence number is not the next sequence number of the first sequencenumber in the first VXLAN packet that has been decapsulated by the firstnetwork device, the first network device stores the second VXLAN packetin the memory.

With reference to the foregoing implementation, for example, a specificimplementation in which the first network device determines whether thesecond sequence number and the second current sequence number areconsecutive is as follows: The first network device determines whether aresult obtained by subtracting the value of the second current sequencenumber from the value of the second sequence number is equal to thefirst step. When the result is equal to the first step, the firstnetwork device may decapsulate the second VXLAN packet and update thevalue of the second current sequence number to the value of the secondsequence number according to the implementation of S110. When the resultis not equal to the first step, the first network device may store thesecond VXLAN packet in the memory.

For example, as shown in FIG. 4, after receiving the VXLAN packet 01,the first network device determines that a result obtained bysubtracting the value (the value is 0) of the second current sequencenumber from the value (the value is 1) of the sequence number of theVXLAN packet 01 is equal to the first step (the value is 1). Therefore,the first network device decapsulates the VXLAN packet 01 and updatesthe value of the second current sequence number to the value of thesequence number of the VXLAN packet 01. Then, the first network devicereceives the VXLAN packet 03. The first network device determines that aresult obtained by subtracting the value (the value is 1) of the secondcurrent sequence number from the value (the value is 3) of the sequencenumber of the VXLAN packet 03 is not equal to the first step (the valueis 1). Therefore, the first network device stores the VXLAN packet 03 inthe memory.

Optionally, the first network device determines whether the memorystores a third VXLAN packet. The third VXLAN packet is a VXLAN packetreceived by the first network device on the first link or the secondlink, and the third VXLAN packet includes a third sequence number and athird service packet. The third sequence number indicates a location ofthe third service packet in the plurality of service packets, and thethird sequence number is a next sequence number of the first sequencenumber in the first VXLAN packet that has been decapsulated by the firstnetwork device, or the third sequence number is a next sequence numberof the second sequence number in the second VXLAN packet that has beendecapsulated by the first network device. When the first network devicedetermines that the memory stores the third VXLAN packet, the firstnetwork device decapsulates the third VXLAN packet.

According to the description of the foregoing implementation, the firstnetwork device determines, based on a sequence number of a receivedVXLAN packet and the second current sequence number, whether thereceived VXLAN packet is a consecutive packet of the VXLAN packet thathas been decapsulated by the first network device. When the VXLAN packetreceived by the first network device is not the consecutive packet, thefirst network device caches the received VXLAN packet into the memory.Therefore, the memory may cache one or more inconsecutive VXLAN packets.In an implementation, it is assumed that the first network device hasdecapsulated the second VXALN packet. In other words, when the VXLANpacket that has been latest decapsulated by the first network device isthe second VXLAN packet, the first network device searches the memoryafter decapsulating the second VXLAN packet and updating the value ofthe second current sequence number, so that the first network devicedetermines whether the third VXLAN packet exists in the memory. A resultobtained by subtracting the value of the second current sequence numberfrom a value of the third sequence number carried in the third VXLANpacket is equal to the first step. To be specific, the first networkdevice determines whether the third VXLAN packet consecutive to thecurrently decapsulated second VXLAN packet exists in the memory. If thethird VXLAN packet exists in the memory, the first network devicedecapsulates the third VXLAN packet and updates the value of the currentsequence number to the value of the third sequence number. Further,optionally, after decapsulating the third VXLAN packet, the firstnetwork device may further continue to determine, according to theforegoing implementation, whether a fourth VXLAN packet consecutive tothe third VXLAN packet exists in the memory. If the fourth VXLAN packetexists in the memory, the first network device decapsulates the fourthVXLAN packet and updates the value of the current sequence number to avalue of the fourth sequence number.

In another implementation, it is assumed that the first network devicehas decapsulated the first VXALN packet. In other words, when the VXLANpacket that has been latest decapsulated by the first network device isthe first VXLAN packet, the value of the second current sequence numberis the value of the first sequence number. The first network devicedetermines whether the third VXLAN packet exists in the memory. Theresult obtained by subtracting the value of the second current sequencenumber from the value of the third sequence number carried in the thirdVXLAN packet is equal to the first step. To be specific, the firstnetwork device determines whether the third VXLAN packet consecutive tothe currently decapsulated first VXLAN packet exists in the memory. Ifthe third VXLAN packet exists in the memory, the first network devicedecapsulates the third VXLAN packet and updates the value of the currentsequence number to the value of the third sequence number.

For example, as shown in FIG. 4, it is assumed that the first networkdevice receives the VXLAN packet 01 and completes processing of theVXLAN packet 01 according to the description of the foregoingimplementation. Then, the first network device successively receives theVXLAN packet 03 and the VXLAN packet 04. According to the description ofthe foregoing implementation, the VXLAN packet 03 and the VXLAN packet04 are cached in the memory. Then, the first network device receives theVXLAN packet 02, and the first network device completes processing ofthe VXLAN packet 02 according to the description of the foregoingimplementation. In this way, the value of the second current sequencenumber is updated to 2. The first network device determines that theVXLAN packet 03 exists in the memory, and the result obtained bysubtracting the value (the value is 2) of the second current sequencenumber from the value (the value is 3) of the sequence number of theVXLAN packet 03 is equal to the first step (the value is 1). The firstnetwork device decapsulates the VXLAN packet 03 and updates the value ofthe second current sequence number to the value of the sequence numberof the VXLAN packet 03. In a same implementation, the first networkdevice may continue to process the VXLAN packet 04 in the memory.

In a possible implementation, the first network device may be configuredto: when determining that the value of the second current sequencenumber is updated, perform an operation of searching for the third VXLANpacket.

According to the foregoing implementation, the first network device maycache an inconsecutive VXLAN packet to the memory, and when detecting aVXLAN packet consecutive to the VXLAN packet cached in the memory, thefirst network device decapsulates the VXLAN packet cached in the memory.This further reduces packet disorder.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the first networkdevice determines whether a value of a fourth sequence number is lessthan a value of a sequence number included in another VXLAN packetstored in the memory, and the first network device determines whetherthe value of the fourth sequence number is greater than a value of thefirst sequence number in the first VXLAN packet that has beendecapsulated by the first network device. The fourth VXLAN packet is aVXLAN packet received by the first network device on the first link orthe second link, the fourth VXLAN packet includes the fourth sequencenumber and a fourth service packet, and the fourth sequence numberindicates a location of the fourth service packet in the plurality ofservice packets. When the first network device determines that the valueof the fourth sequence number is less than the value of the sequencenumber included in the another VXLAN packet stored in the memory, andthe value of the fourth sequence number is greater than a the value ofthe first sequence number in the first VXLAN packet that has beendecapsulated by the first network device, the first network devicedecapsulates the fourth VXLAN packet.

If a packet loss has occurred in a previous consecutive packet of thefourth VXLAN packet on a transmission path, the first network devicecannot receive the previous consecutive packet of the fourth VXLANpacket, and the fourth VXLAN packet cannot always be a consecutivepacket of a VXLAN packet that has been latest decapsulated by the firstnetwork device. As a result, packet transmission is interrupted. Toavoid packet transmission interruption caused by the packet loss, thefirst network device may further include a first timer. The first timeris configured to record the residence time of the fourth VXLAN packetentering the memory, and the residence time is referred to as a firstcache time. When the fourth VXLAN packet enters the memory, the firsttimer starts to time. The first network device further includes thefirst time threshold. If the first cache time exceeds the first timethreshold, and the first network device determines that the fourthsequence number of the fourth VXLAN packet is a smallest sequence numberin the memory and that the value of the fourth sequence number isgreater than the value of the second current sequence number, the firstnetwork device forcibly decapsulates the fourth VXLAN packet, andupdates the value of the second current sequence number. Optionally,when the VXLAN packet that has been latest decapsulated by the firstnetwork device is the first VXLAN packet, the value of the secondcurrent sequence number is the value of the first sequence number. Whenthe VXLAN packet that has been latest decapsulated by the first networkdevice is the second VXLAN packet, the value of the second currentsequence number is the value of the second sequence number. When theVXLAN packet that has been latest decapsulated by the first networkdevice is the third VXLAN packet, the value of the second currentsequence number is the value of the third sequence number.

For example, as shown in FIG. 4, after receiving the VXLAN packet 01,the first network device receives the VXLAN packet 03 and the VXLANpacket 04. According to the description of the foregoing implementation,the VXLAN packet 03 and the VXLAN packet 04 are cached in the memory.Assuming that a packet loss occurs in a transmission process of theVXLAN packet 02, the first network device cannot receive the VXLANpacket 02. In this case, the first network device has decapsulated theVXLAN packet 01, and updated the value of the second current sequencenumber to 1. According to an implementation of the foregoingimplementation, the first network device cannot find, in the memory, asequence number whose value is greater than the value of the secondcurrent sequence number by the first step (the value is 1). When a cachetime of the VXLAN packet 03 exceeds the first time threshold, and thefirst network device may determine that the sequence number of the VXLANpacket 03 is the smallest sequence number in the memory and the value(the value is 3) of the sequence number of the VXLAN packet 03 isgreater than the value (the value is 1) of the second current sequencenumber, the first network device decapsulates the VXLAN packet 03 andupdates the value of the second current sequence number to the value ofthe sequence number of the VXLAN packet 03.

According to the foregoing implementation, it is ensured that serviceinterruption is not caused by a packet loss on a link in the VXLANtunnel during data flow transmission between the first network deviceand the second network device.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the first networkdevice determines whether a value of a fourth sequence number is greaterthan a value of a sequence number included in another VXLAN packetstored in the memory. The fourth VXLAN packet is a VXLAN packet receivedby the first network device on the first link or the second link, thefourth VXLAN packet includes the fourth sequence number and a fourthservice packet, and the fourth sequence number indicates a location ofthe fourth service packet in the plurality of service packets. When thefirst network device determines that the value of the fourth sequencenumber is greater than the value of the sequence number included in theanother VXLAN packet stored in the memory, the first network deviceresets the residence time of the fourth VXLAN packet in the memory, andre-counts the residence time of the fourth VXLAN packet in the memory.

For example, as shown in FIG. 4, after the first network device receivesthe VXLAN packet 01, the first network device receives the VXLAN packet04 before receiving the VXLAN packet 03. According to the description ofthe foregoing implementation, the VXLAN packet 03 and the VXLAN packet04 are cached in the memory. Assuming that a packet loss occurs in atransmission process of the VXLAN packet 02, the first network devicecannot receive the VXLAN packet 02. In this way, a cache time of theVXLAN packet 04 exceeds the time threshold earlier than the cache timeof the VXLAN packet 03. The first network device determines that asequence number of the VXLAN packet 04 is not the smallest sequencenumber in the memory, and the first network device resets the cache timeof the VXLAN packet 04 to 0. In this way, the cache time of the VXLANpacket 04 is recounted, to ensure that the cache time of the VXLANpacket 03 first exceeds the time threshold. Therefore, the first networkdevice can decapsulate the VXLAN packet 03 before decapsulating theVXLAN packet 04, to further reduce disorder.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the first networkdevice determines whether a value of a fourth sequence number is lessthan a value of a sequence number included in another VXLAN packetstored in the memory, and the first network device determines whether anabsolute value of a difference between the value of the fourth sequencenumber and a value of a sequence number in a VXLAN packet that has beenlatest decapsulated by the first network device is greater than a firstsequence number threshold. The fourth VXLAN packet is a VXLAN packetreceived by the first network device on the first link or the secondlink, the fourth VXLAN packet includes the fourth sequence number and afourth service packet, the fourth sequence number indicates a locationof the fourth service packet in the plurality of service packets, and arange of the first sequence number threshold is [0.5N, N], where Nindicates an upper limit value of a sequence number in a VXLAN packetsent by the second network device. When the first network devicedetermines that the value of the fourth sequence number is less than thevalue of the sequence number included in the another VXLAN packet storedin the memory, and the absolute value of the difference between thevalue of the fourth sequence number and the value of the sequence numberin the VXLAN packet that has been latest decapsulated by the firstnetwork device is greater than the first sequence number threshold, thefirst network device decapsulates the fourth VXLAN packet.

Generally, in this embodiment of this application, an upper limit valueof a sequence number that can be carried in a VXLAN packet is greaterthan a quantity of service packets included in a transmitted data flow.For example, a quantity of service packets included in the data flow 01is 5000000, and the upper limit value of the sequence number is FFFFFF(hexadecimal). In a possible implementation, the data amount of the dataflow 01 may be relatively large, and consequently the quantity ofservice packets included in the data flow 01 exceeds the upper limitvalue (for example, FFFFFF) of the sequence number that can be carriedin the VXLAN packet. In this way, in a process in which the secondnetwork device sends the VXLAN packet of the data flow 01, it is assumedthat the value of the first current sequence number is FFFFFF. Beforesending a next VXLAN packet of the data flow 01, the second networkdevice adds the first step (the value is 1) to the value (FFFFFF) of thefirst current sequence number, and the value of the first currentsequence number is updated to 0 (a total of 24 bits calculated in abinary mode). This is called sequence number reversion. To be specific,a sequence number is recounted after being updated to a maximum value.

Correspondingly, on a first network device side, it is assumed that thevalue of the second current sequence number is FFFFFF, and a reversionthreshold is FFFFFF. Because the sequence number reaches the upper limitvalue, the first network device cannot find a packet whose sequencenumber is greater than FFFFFF in the memory. The first network devicefurther receives the fourth VXLAN packet. It is assumed that the fourthsequence number of the fourth VXLAN packet is 0 (according to theforegoing description, the fourth sequence number is a reversed sequencenumber). When the fourth VXLAN packet times out in the memory, the firstnetwork device determines that a value obtained by subtracting the value(the value is FFFFFF) of the second current sequence number from thevalue (the value is 0) of the fourth sequence number is −FFFFFF, and anabsolute value of the value is FFFFFF. The first network devicedetermines that a calculation result is equal to the reversion thresholdFFFFFF. Therefore, the first network device may determine that thefourth VXLAN packet is a consecutive VXLAN packet, and the first networkdevice decapsulates the fourth VXLAN packet and updates the value of thesecond current sequence number to the value of the fourth sequencenumber.

According to the foregoing implementation, the VXLAN tunnel between thefirst network device and the second network device may reduce disorderwhen data flows with a large data amount (which may be referred to as an“elephant flow”) are transmitted. In actual application, a set value ofthe reversion threshold may be less than the upper limit value of thesequence number. As long as it is ensured that the set value of thereversion threshold indicates, on an order of magnitude, that the usedsequence number reaches the upper limit value. For example, if thereversion threshold is set to FFFFFD, a reversed VXLAN packet can stillbe normally decapsulated even if a packet loss occurs in a VXLAN packetwhose sequence number is FFFFFD. In the foregoing implementation, therange of the first sequence number threshold is [0.5N, N], where Nindicates an upper limit value of a sequence number in a VXLAN packetsent by the second network device. Such a setting helps increasetolerance of the first network device when the first network devicedetermines to perform reversion.

In a possible implementation, the VXLAN packet may include a reverseflag bit, and the reverse flag bit is used to indicate whether asequence number carried in a VXLAN packet is reversed. For example, whenthe sequence number is reversed, the second network device sets thereverse flag bit from 0 to 1. When the sequence number is reversedagain, the second network device sets the reverse flag bit from 1 to 0.In this way, the second network device used as a receive end maydetermine, based on the reverse flag bit, that the last VXLAN packet(which may be referred to as a tail packet) before reversion and thefirst reversed VXLAN packet (which may be referred to as an initialpacket) are mutually consecutive VXLAN packets.

In a possible implementation, the first network device may furtherinclude a second timer, and the second timer is configured to record atotal cache time of the VXLAN packets in the memory. In this way, evenif the cache time recorded by using the first timer is reset, the totalcache time recorded by using the second timer is not reset. When thefirst network device determines that the total cache time reaches thefirst time threshold, the first network device discards the VXLANpackets corresponding to the total cache time. An objective of such asetting is to prevent an individual VXLAN packet that cannot bedecapsulated from occupying storage space of the memory for a long timedue to a packet transmission error or an error in processing by thefirst network device.

In this embodiment of this application, the space of the memory may beset based on a network status. For example, performance of the pluralityof links in the VXLAN tunnel is relatively good, and the space of thememory may be set to be relatively small. The performance may include adelay, a packet loss rate, and a jitter of a link. When the firstnetwork device determines that occupancy of the memory reaches 100%, thefirst network device may forcibly decapsulate a packet in the memoryaccording to a sequence of sequence numbers of VXLAN packets cached inthe memory, and update the second current sequence number.

FIG. 8 is a schematic structural diagram of a first network device 1000according to an embodiment of this application. The first network device1000 shown in FIG. 8 may perform corresponding steps performed by thefirst network device in the method in the foregoing embodiment. Thefirst network device is deployed in a VXLAN, and the VXLAN furtherincludes a second network device. The first network device is connectedto the second network device through a VXLAN tunnel, and the VXLANtunnel includes a first link and a second link. As shown in FIG. 8, thefirst network device 1000 includes a receiving unit 1002 and aprocessing unit 1004.

The receiving unit 1002 is configured to receive, on the first link, afirst VXLAN packet sent by the second network device, where the firstVXLAN packet includes a first sequence number and a first servicepacket, and the first sequence number indicates a location of the firstservice packet in a plurality of service packets.

The processing unit 1004 is configured to decapsulate the first VXLANpacket.

The receiving unit 1002 is further configured to receive, on the secondlink, a second VXLAN packet sent by the second network device, where thesecond VXLAN packet includes a second sequence number and a secondservice packet, and the second sequence number indicates a location ofthe second service packet in the plurality of service packets.

After the processing unit 1004 decapsulates the first VXLAN packet, theprocessing unit 1004 is further configured to determine whether thesecond sequence number is a next sequence number of the first sequencenumber.

When the processing unit 1004 determines that the second sequence numberis the next sequence number of the first sequence number, the processingunit 1004 is further configured to decapsulate the second VXLAN packet.

Optionally, when the processing unit 1004 determines that the secondsequence number is not the next sequence number of the first sequencenumber in the first VXLAN packet that has been decapsulated by theprocessing unit 1004, the processing unit 1004 is further configured tostore the second VXLAN packet in a memory.

Optionally, the processing unit 1004 is further configured to determinewhether the memory stores a third VXLAN packet, where the third VXLANpacket is a VXLAN packet received by the receiving unit 1002 on thefirst link or the second link, the third VXLAN packet includes a thirdsequence number and a third service packet, the third sequence numberindicates a location of the third service packet in the plurality ofservice packets, and the third sequence number is a next sequence numberof the first sequence number in the first VXLAN packet that has beendecapsulated by the processing unit 1004. When the processing unit 1004determines that the memory stores the third VXLAN packet, the processingunit 1004 is further configured to decapsulate the third VXLAN packet.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the processing unit1004 is further configured to determine whether a value of a fourthsequence number is less than a value of a sequence number included inanother VXLAN packet stored in the memory, and the processing unit 1004is further configured to determine whether the value of the fourthsequence number is greater than a value of the first sequence number inthe first VXLAN packet that has been decapsulated by the processing unit1004. The fourth VXLAN packet is a VXLAN packet received by thereceiving unit 1002 on the first link or the second link, the fourthVXLAN packet includes the fourth sequence number and a fourth servicepacket, and the fourth sequence number indicates a location of thefourth service packet in the plurality of service packets. When theprocessing unit 1004 determines that the value of the fourth sequencenumber is less than the value of the sequence number included in theanother VXLAN packet stored in the memory, and the value of the fourthsequence number is greater than the value of the first sequence numberin the first VXLAN packet that has been decapsulated by the processingunit 1004, the processing unit 1004 is further configured to decapsulatethe fourth VXLAN packet.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the processing unit1004 is further configured to determine whether a value of a fourthsequence number is greater than a value of a sequence number included inanother VXLAN packet stored in the memory. The fourth VXLAN packet is aVXLAN packet received by the receiving unit 1002 on the first link orthe second link, the fourth VXLAN packet includes the fourth sequencenumber and a fourth service packet, and the fourth sequence numberindicates a location of the fourth service packet in the plurality ofservice packets. When the processing unit 1004 determines that the valueof the fourth sequence number is greater than the value of the sequencenumber included in the another VXLAN packet stored in the memory, theprocessing unit 1004 is further configured to: reset the residence timeof the fourth VXLAN packet in the memory, and re-count the residencetime of the fourth VXLAN packet in the memory.

Optionally, when residence time of a fourth VXLAN packet in the memoryis greater than or equal to a first time threshold, the processing unit1004 is further configured to determine whether a value of a fourthsequence number is less than a value of a sequence number included inanother VXLAN packet stored in the memory, and the processing unit 1004is further configured to determine whether an absolute value of adifference between the value of the fourth sequence number and a valueof the first sequence number in the first VXLAN packet that has beendecapsulated by the processing unit 1004 is greater than a firstsequence number threshold. The fourth VXLAN packet is a VXLAN packetreceived by the receiving unit 1002 on the first link or the secondlink, the fourth VXLAN packet includes the fourth sequence number and afourth service packet, the fourth sequence number indicates a locationof the fourth service packet in the plurality of service packets, and arange of the first sequence number threshold is [0.5N, N], where Nindicates an upper limit value of a sequence number in a VXLAN packetsent by the second network device. When the processing unit 1004determines that the value of the fourth sequence number is less than thevalue of the sequence number included in the another VXLAN packet storedin the memory, and the absolute value of the difference between thevalue of the fourth sequence number and the value of the first sequencenumber in the first VXLAN packet that has been decapsulated by theprocessing unit 1004 is greater than the first sequence numberthreshold, the processing unit 1004 is further configured to decapsulatethe fourth VXLAN packet.

Optionally, the first VXLAN packet further includes an identifier of afirst data flow, and the first data flow includes the plurality ofservice packets.

The first network device 1000 shown in FIG. 8 may perform thecorresponding steps performed by the first network device in the methodin the foregoing embodiment. The first network device is applied to aVXLAN scenario. The second network device transmits a plurality of VXLANpackets to the first network device on a plurality of links included inthe VXLAN tunnel in a per-packet load balancing manner, and loadscarried in the plurality of VXLAN packets belong to a same data flow.Each of the plurality of VXLAN packets includes a sequence number.Correspondingly, after receiving a VXLAN packet sent by the secondnetwork device, the first network device processes the VXLAN packetbased on a sequence number carried in the VXLAN packet and a currentsequence number stored in the first network device. According to thedevice provided in this embodiment, the sequence number is applied totransmission of the VXLAN packet, so that data traffic is transmittedthrough the VXLAN tunnel in an ordered per-packet load balancing manner.This reduces packet disorder and increases bandwidth utilization of theVXLAN tunnel.

FIG. 9 is a schematic diagram of a hardware structure of a first networkdevice 1100 according to an embodiment of this application. The firstnetwork device 1100 shown in FIG. 9 may perform corresponding stepsperformed by the first network device in the method in the foregoingembodiment.

As shown in FIG. 9, the first network device 1100 includes a processor1101, a memory 1102, an interface 1103, and a bus 1104. The interface1103 may be implemented in a wireless or wired manner, and may bespecifically a network adapter. The processor 1101, the memory 1102, andthe interface 1103 are connected by using the bus 1104.

The interface 1103 may specifically include a transmitter and areceiver, and is configured by the first network device to receiveinformation from and send information to the second network device inthe foregoing embodiment. For example, the interface 1103 is configuredto support receiving of a VXLAN packet sent by the second networkdevice. For example, the interface 1103 is configured to support theprocesses S104 and S108 in FIG. 3. The processor 1101 is configured toperform processing performed by the first network device in theforegoing embodiment. For example, the processor 1101 is configured to:decapsulate a VXLAN packet; determine whether sequence numbers includedin VXLAN packets are consecutive; and/or support another process usedfor the technology described in this specification. For example, theprocessor 1101 is configured to support the processes S105, S109 andS110 in FIG. 3. The memory 1102 includes an operating system 11021 andan application program 11022, and is configured to store a program,code, or an instruction. When executing the program, code, orinstruction, the processor or a hardware device may complete aprocessing process of the first network device in the foregoing methodembodiment. Optionally, the memory 1102 may include a read-only memory(ROM) and a random access memory (RAM). The ROM includes a basicinput/output system (BIOS) or an embedded system, and the RAM includesan application program and an operating system. When the first networkdevice 1100 needs to run, a bootloader in the BIOS or the embeddedsystem that is built into the ROM is used to boot a system to start, andboot the first network device 1100 to enter a normal running state.After entering the normal running state, the first network device 1100runs the application program and the operating system in the RAM, tocomplete the processing processes of the first network device in themethod embodiment.

It may be understood that FIG. 9 shows only a simplified design of thefirst network device 1100. In actual application, the first networkdevice may include any quantity of interfaces, processors, or memories.

FIG. 10 is a schematic diagram of a hardware structure of another firstnetwork device 1200 according to an embodiment of this application. Thefirst network device 1200 shown in FIG. 10 may perform correspondingsteps performed by the first network device in the method in theforegoing embodiment.

As shown in FIG. 10, the first network device 1200 includes a maincontrol board 1210, an interface board 1230, a switching board 1220, andan interface board 1240. The main control board 1210, the interfaceboards 1230 and 1240, and the switching board 1220 are connected to asystem backboard by using a system bus for communication. The maincontrol board 1210 is configured to complete functions such as systemmanagement, device maintenance, and protocol processing. The switchingboard 1220 is configured to complete data exchange between interfaceboards (the interface board is also referred to as a line card or aservice board). The interface boards 1230 and 1240 are configured toprovide various service interfaces (for example, a POS interface, a GEinterface, and an ATM interface), and forward a data packet.

The interface board 1230 may include a central processing unit 1231, aforwarding entry memory 1234, a physical interface card 1233, and anetwork processor 1232. The central processing unit 1231 is configuredto control and manage the interface board, and communicate with thecentral processing unit on the main control board. The forwarding entrymemory 1234 is configured to store a forwarding entry. The physicalinterface card 1233 is configured to receive and send traffic. Thenetwork processor 1232 is configured to control, based on the forwardingentry, the physical interface card 1233 to receive and send the traffic.

Specifically, the physical interface card 1233 is configured to receivea VXLAN packet sent by the second network device.

The central processing unit 1231 is configured to decapsulate the VXLANpacket.

The central processing unit 1231 is further configured to determinewhether sequence numbers included in VXLAN packets are consecutive.

After receiving the VXLAN packet, the physical interface card 1233 sendsthe VXLAN packet to the central processing unit 1231 by using thecentral processing unit 1231, and the central processing unit 1231processes the VXLAN packet.

The central processing unit 1231 is further configured to control thenetwork processor 1232 to obtain the forwarding entry in the forwardingentry memory 1234, and the central processing unit 1231 is furtherconfigured to control the network processor 1232 to send and receive thetraffic by using the physical interface card 1233.

It should be understood that operations on the interface board 1240 arethe same as the operations on the interface board 1230 in thisembodiment of the present application. For brevity, details are notdescribed. It should be understood that the first network device 1200 inthis embodiment may correspond to the functions and/or the variousimplemented steps in the foregoing method embodiment. Details are notdescribed herein.

In addition, it should be noted that there may be one main control boardor a plurality of main control boards. When there are the plurality ofmain control boards, a primary main control board and a secondary maincontrol board may be included. There may be one or more interfaceboards, and a first network device having a stronger data processingcapability provides more interface boards. There may also be one or morephysical interface cards on the interface board. There may be noswitching board or one switching board or a plurality of switchingboards. When there are the plurality of switching boards, load sharingand redundancy backup may be implemented together. In a centralizedforwarding architecture, the first network device may need no switchingboard, and the interface board provides a function of processing servicedata of an entire system. In a distributed forwarding architecture, thefirst network device may have at least one switching board, and dataexchange between a plurality of interface boards is performed by usingthe switching board, to provide large-capacity data exchange and aprocessing capability. Therefore, data access and a processingcapability of the first network device in the distributed architectureis better than data access and a processing capability of the firstnetwork device in the centralized architecture. Which architecture isspecifically used depends on a specific networking deployment scenario,and this is not limited herein.

FIG. 11 is a schematic structural diagram of a second network device2000 according to an embodiment of this application. The second networkdevice 2000 shown in FIG. 11 may perform corresponding steps performedby the second network device in the method in the foregoing embodiment.The second network device is deployed in a VXLAN, and the VXLAN furtherincludes a first network device. The first network device is connectedto the second network device through a VXLAN tunnel, and the VXLANtunnel includes a first link and a second link. As shown in FIG. 11, thesecond network device 2000 includes a receiving unit 2002, a processingunit 2004, and a sending unit 2006.

The receiving unit 2002 is configured to receive a plurality of servicepackets from a virtual machine VM, where the plurality of servicepackets include a first service packet and a second service packet.

The processing unit 2004 is configured to generate a first VXLAN packetbased on the first service packet, where the first VXLAN packet includesa first sequence number and the first service packet, and the firstsequence number indicates a location of the first service packet in theplurality of service packets.

The sending unit 2006 is configured to send the first VXLAN packet tothe first network device on the first link.

The processing unit 2004 is further configured to generate a secondVXLAN packet based on the second service packet, where the second VXLANpacket includes a second sequence number and the second service packet,the second sequence number indicates a location of the second servicepacket in the plurality of service packets, and the second sequencenumber is a next sequence number of the first sequence number.

After the sending unit 2006 sends the first VXLAN packet to the firstnetwork device on the first link, the sending unit 2006 is furtherconfigured to send the second VXLAN packet to the first network deviceon the second link.

Optionally, the first VXLAN packet includes a VXLAN header, and theVXLAN header includes the first sequence number.

Optionally, the first VXLAN packet includes a generic networkvirtualization encapsulation GENEVE header, the GENEVE header includes asequence number type-length-value TLV, and the sequence number TLVincludes the first sequence number.

Optionally, the first VXLAN packet further includes an identifier of afirst data flow, and the first data flow includes the plurality ofservice packets.

The second network device shown in FIG. 11 may perform the correspondingsteps performed by the second network device in the method in theforegoing embodiment. The second network device is applied to a VXLANscenario. The second network device transmits a plurality of VXLANpackets to the first network device on a plurality of links included inthe VXLAN tunnel in a per-packet load balancing manner, and loadscarried in the plurality of VXLAN packets belong to a same data flow.Each of the plurality of VXLAN packets includes a sequence number.Correspondingly, after receiving a VXLAN packet sent by the secondnetwork device, the first network device processes the VXLAN packetbased on a sequence number carried in the VXLAN packet and a currentsequence number stored in the first network device. According to thedevice provided in this embodiment, the sequence number is applied totransmission of the VXLAN packet, so that data traffic is transmittedthrough the VXLAN tunnel in an ordered per-packet load balancing manner.This reduces packet disorder and increases bandwidth utilization of theVXLAN tunnel.

FIG. 12 is a schematic diagram of a hardware structure of a secondnetwork device 2100 according to an embodiment of this application. Thesecond network device 2100 shown in FIG. 12 may perform correspondingsteps performed by the second network device in the method in theforegoing embodiment.

As shown in FIG. 12, the second network device 2100 includes a processor2101, a memory 2102, an interface 2103, and a bus 2104. The interface2103 may be implemented in a wireless or wired manner, and may bespecifically a network adapter. The processor 2101, the memory 2102, andthe interface 2103 are connected by using the bus 2104.

The interface 2103 may specifically include a transmitter and areceiver, and is configured to send and receive information between thesecond network device and the first network device in the foregoingembodiment. For example, the interface 2103 is configured to supportsending of a VXLAN packet to the first network device, and is furtherconfigured to support receiving of a service packet from a VM. Forexample, the interface 2103 is configured to support the processes S101,S103, and S107 in FIG. 3. The processor 2101 is configured to performprocessing performed by the second network device in the foregoingembodiment. For example, the processor 2101 is configured to:encapsulate a VXLAN packet; and/or support another process used for thetechnology described in this specification. For example, the processor2101 is configured to support the processes S102 and S106 in FIG. 3. Thememory 2102 includes an operating system 21021 and an applicationprogram 21022, and is configured to store a program, code, or aninstruction. When executing the program, code, or instruction, theprocessor or a hardware device may complete a processing process of thesecond network device in the foregoing method embodiment. Optionally,the memory 2102 may include a read-only memory (ROM) and a random accessmemory (RAM). The ROM includes a basic input/output system (BIOS) or anembedded system, and the RAM includes an application program and anoperating system. When the second network device 2100 needs to run, abootloader in the BIOS or the embedded system that is built into the ROMis used to boot a system to start, and boot the second network device2100 to enter a normal running state. After entering the normal runningstate, the second network device 2100 runs the application program andthe operating system in the RAM, to complete the processing process ofthe second network device in the method embodiment.

It may be understood that FIG. 12 shows only a simplified design of thesecond network device 2100. In actual application, the second networkdevice may include any quantity of interfaces, processors, or memories.

FIG. 13 is a schematic diagram of a hardware structure of another secondnetwork device 2200 according to an embodiment of this application. Thesecond network device 2200 shown in FIG. 13 may perform correspondingsteps performed by the second network device in the method in theforegoing embodiment.

As shown in FIG. 13, the second network device 2200 includes a maincontrol board 2210, an interface board 2230, a switching board 2220, andan interface board 2240. The main control board 2210, the interfaceboards 2230 and 2240, and the switching board 2220 are connected to asystem backboard by using a system bus for communication. The maincontrol board 2210 is configured to complete functions such as systemmanagement, device maintenance, and protocol processing. The switchingboard 2220 is configured to complete data exchange between interfaceboards (the interface board is also referred to as a line card or aservice board). The interface boards 2230 and 2240 are configured toprovide various service interfaces (for example, a POS interface, a GEinterface, and an ATM interface), and forward a data packet.

The interface board 2230 may include a central processing unit 2231, aforwarding entry memory 2234, a physical interface card 2233, and anetwork processor 2232. The central processing unit 2231 is configuredto control and manage the interface board, and communicate with thecentral processing unit on the main control board. The forwarding entrymemory 2234 is configured to store a forwarding entry. The physicalinterface card 2233 is configured to receive and send traffic. Thenetwork processor 2232 is configured to control, based on the forwardingentry, the physical interface card 2233 to receive and send the traffic.

Specifically, the physical interface card 2233 is configured to receivea service packet sent by a VM, or is configured to send a VXLAN packetto the first network device.

The central processing unit 2231 is configured to encapsulate a servicepacket into a VXLAN packet.

The central processing unit 2231 sends the VXLAN packet to the physicalinterface card 2233 by using the central processing unit 2231. Thephysical interface card 2233 sends the VXLAN packet to the first networkdevice.

The central processing unit 2231 is further configured to control thenetwork processor 2232 to obtain the forwarding entry in the forwardingentry memory 2234, and the central processing unit 2231 is furtherconfigured to control the network processor 2232 to send and receive thetraffic by using the physical interface card 2233.

It should be understood that operations on the interface board 2240 arethe same as the operations on the interface board 2230 in thisembodiment of the present application. For brevity, details are notdescribed. It should be understood that the second network device 2200in this embodiment may correspond to the functions and/or the variousimplemented steps in the foregoing method embodiment. Details are notdescribed herein.

In addition, it should be noted that there may be one main control boardor a plurality of main control boards. When there are the plurality ofmain control boards, a primary main control board and a secondary maincontrol board may be included. There may be one or more interfaceboards, and a second network device having a stronger data processingcapability provides more interface boards. There may also be one or morephysical interface cards on the interface board. There may be noswitching board or one switching board or a plurality of switchingboards. When there are the plurality of switching boards, load sharingand redundancy backup may be implemented together. In a centralizedforwarding architecture, the second network device may need no switchingboard, and the interface board provides a function of processing servicedata of an entire system. In a distributed forwarding architecture, thesecond network device may have at least one switching board, and dataexchange between a plurality of interface boards is performed by usingthe switching board, to provide large-capacity data exchange and aprocessing capability. Therefore, data access and a processingcapability of the second network device in the distributed architectureis better than data access and a processing capability of the secondnetwork device in the centralized architecture. Which architecture isspecifically used depends on a specific networking deployment scenario,and this is not limited herein.

In addition, an embodiment of this application provides a computerstorage medium, configured to store a computer software instruction usedby the foregoing first network device. The computer software instructionincludes a program designed for performing the foregoing methodembodiment.

In addition, an embodiment of this application provides a computerstorage medium, configured to store a computer software instruction usedby the foregoing second network device. The computer softwareinstruction includes a program designed for performing the foregoingmethod embodiment.

An embodiment of this application further includes a network system. Thenetwork system includes a first network device and a second networkdevice. The first network device is the first network device in FIG. 8,FIG. 9, or FIG. 10, and the second network device is the second networkdevice in FIG. 11, FIG. 12, or FIG. 13.

Method or algorithm steps described in combination with the contentdisclosed in this application may be implemented by hardware, or may beimplemented by a processor by executing a software instruction. Thesoftware instruction may be formed by a corresponding software module.The software module may be stored in a RAM memory, a flash memory, a ROMmemory, an EPROM memory, an EEPROM memory, a register, a hard disk, aremovable magnetic disk, a CD-ROM, or a storage medium of any other formknown in the art. For example, a storage medium is coupled to aprocessor, so that the processor can read information from the storagemedium or write information into the storage medium. Certainly, thestorage medium may be a component of the processor. The processor andthe storage medium may be located in an ASIC. In addition, the ASIC maybe located in user equipment. Certainly, the processor and the storagemedium may exist in the user equipment as discrete components.

A person skilled in the art should be aware that in one or more of theforegoing examples, the functions described in this application may beimplemented by hardware or a combination of hardware and software. Whenthis application is implemented by a combination of hardware andsoftware, the software may be stored in a computer-readable medium ortransmitted as one or more instructions or one or more pieces of code inthe computer-readable medium. The computer-readable medium includes acomputer storage medium and a communications medium, where thecommunications medium includes any medium that enables a computerprogram to be transmitted from one place to another place. The storagemedium may be any available medium accessible to a general-purpose orspecial-purpose computer.

The objectives, technical solutions, and beneficial effects of thisapplication are further described in detail in the foregoing specificimplementations. It should be understood that the foregoing descriptionsare merely specific implementations of this application.

1-17. (canceled)
 18. A method comprising: receiving, by a first networkdevice of a virtual extensible local area network (VXLAN) on a firstlink, a first VXLAN packet sent by a second network device, the VXLANcomprising the first network device and the second network device, thefirst network device connected to the second network device through aVXLAN tunnel, and the VXLAN tunnel comprising the first link and asecond link, wherein the first VXLAN packet comprises a first sequencenumber and a first service packet, and the first sequence numberindicates a location of the first service packet in a plurality ofservice packets; decapsulating, by the first network device, the firstVXLAN packet; receiving, by the first network device on the second link,a second VXLAN packet sent by the second network device, wherein thesecond VXLAN packet comprises a second sequence number and a secondservice packet, and the second sequence number indicates a location ofthe second service packet in the plurality of service packets; after thefirst network device decapsulates the first VXLAN packet, determining,by the first network device, whether the second service packet is a nextservice packet of the first service packet in the plurality of servicepackets; and when the first network device determines that the secondservice packet is the next service packet of the first service packet,decapsulating, by the first network device, the second VXLAN packet. 19.The method according to claim 18, wherein the method further comprises:when the first network device determines that the second service packetis not the next service packet of the first service packet in the firstVXLAN packet that has been decapsulated by the first network device,storing, by the first network device, the second VXLAN packet in amemory.
 20. The method according to claim 19, wherein the method furthercomprises: determining, by the first network device, whether a thirdVXLAN packet is stored in the memory, wherein the third VXLAN packet isa VXLAN packet received by the first network device on the first link orthe second link, the third VXLAN packet comprises a third sequencenumber and a third service packet, the third sequence number indicates alocation of the third service packet in the plurality of servicepackets, and the third service packet is the next service packet of thefirst service packet in the first VXLAN packet that has beendecapsulated by the first network device; and when the first networkdevice determines that the third VXLAN packet is stored in the memory,decapsulating, by the first network device, the third VXLAN packet. 21.The method according to claim 19, wherein the method further comprises:when residence time of a fourth VXLAN packet in the memory is greaterthan or equal to a first time threshold, determining, by the firstnetwork device, whether a value of a fourth sequence number is less thana value of a sequence number comprised in another VXLAN packet stored inthe memory, and determining, by the first network device, whether thevalue of the fourth sequence number is greater than a value of the firstsequence number in the first VXLAN packet that has been decapsulated bythe first network device, wherein the fourth VXLAN packet is a VXLANpacket received by the first network device on the first link or thesecond link, the fourth VXLAN packet comprises the fourth sequencenumber and a fourth service packet, and the fourth sequence numberindicates a location of the fourth service packet in the plurality ofservice packets; and when the first network device determines that thevalue of the fourth sequence number is less than the value of thesequence number comprised in the another VXLAN packet stored in thememory, and the value of the fourth sequence number is greater than thevalue of the first sequence number in the first VXLAN packet that hasbeen decapsulated by the first network device, decapsulating, by thefirst network device, the fourth VXLAN packet.
 22. The method accordingto claim 19, wherein the method further comprises: when residence timeof a fourth VXLAN packet in the memory is greater than or equal to afirst time threshold, determining, by the first network device, whethera value of a fourth sequence number is greater than a value of asequence number comprised in another VXLAN packet stored in the memory,wherein the fourth VXLAN packet is a VXLAN packet received by the firstnetwork device on the first link or the second link, the fourth VXLANpacket comprises the fourth sequence number and a fourth service packet,and the fourth sequence number indicates a location of the fourthservice packet in the plurality of service packets; and when the firstnetwork device determines that the value of the fourth sequence numberis greater than the value of the sequence number comprised in theanother VXLAN packet stored in the memory, resetting, by the firstnetwork device, the residence time of the fourth VXLAN packet in thememory, and re-counting the residence time of the fourth VXLAN packet inthe memory.
 23. The method according to claim 19, wherein the methodfurther comprises: when residence time of a fourth VXLAN packet in thememory is greater than or equal to a first time threshold, determining,by the first network device, whether a value of a fourth sequence numberis less than a value of a sequence number comprised in another VXLANpacket stored in the memory, and determining, by the first networkdevice, whether an absolute value of a difference between the value ofthe fourth sequence number and a value of the first sequence number inthe first VXLAN packet that has been decapsulated by the first networkdevice is greater than a first sequence number threshold, wherein thefourth VXLAN packet is a VXLAN packet received by the first networkdevice on the first link or the second link, the fourth VXLAN packetcomprises the fourth sequence number and a fourth service packet, thefourth sequence number indicates a location of the fourth service packetin the plurality of service packets, and a range of the first sequencenumber threshold is [0.5N, N], wherein N indicates an upper limit valueof a sequence number in a VXLAN packet sent by the second networkdevice; and when the first network device determines that the value ofthe fourth sequence number is less than the value of the sequence numbercomprised in the another VXLAN packet stored in the memory, and theabsolute value of the difference between the value of the fourthsequence number and the value of the first sequence number in the firstVXLAN packet that has been decapsulated by the first network device isgreater than the first sequence number threshold, decapsulating, by thefirst network device, the fourth VXLAN packet.
 24. The method accordingto claim 18, wherein the first VXLAN packet further comprises anidentifier of a first data flow, and the first data flow comprises theplurality of service packets.
 25. A first network device in a virtualextensible local area network (VXLAN), wherein the first network devicecomprises: a receiver, configured to receive, on a first link, a firstVXLAN packet sent by a second network device in the VXLAN, the firstnetwork device connected to the second network device through a VXLANtunnel, and the VXLAN tunnel comprising the first link and a secondlink, wherein the first VXLAN packet comprises a first sequence numberand a first service packet, and the first sequence number indicates alocation of the first service packet in a plurality of service packets;and a processor, configured to decapsulate the first VXLAN packet;wherein the receiver is further configured to receive, on the secondlink, a second VXLAN packet sent by the second network device, whereinthe second VXLAN packet comprises a second sequence number and a secondservice packet, and the second sequence number indicates a location ofthe second service packet in the plurality of service packets; after theprocessor decapsulates the first VXLAN packet, the processor is furtherconfigured to determine whether the second service packet is a nextservice packet of the first service packet in the plurality of servicepackets; and when the processor determines that the second servicepacket is the next service packet of the first service packet, theprocessor is further configured to decapsulate the second VXLAN packet.26. The first network device according to claim 25, wherein when theprocessor determines that the second service packet is not the nextservice packet of the first service packet in the first VXLAN packetthat has been decapsulated by the processor, the processor is furtherconfigured to store the second VXLAN packet in a memory.
 27. The firstnetwork device according to claim 26, wherein the processor is furtherconfigured to determine whether a third VXLAN packet is stored in thememory, wherein the third VXLAN packet is a VXLAN packet received by thereceiver on the first link or the second link, the third VXLAN packetcomprises a third sequence number and a third service packet, the thirdsequence number indicates a location of the third service packet in theplurality of service packets, and the third service packet is the nextservice packet of the first service packet in the first VXLAN packetthat has been decapsulated by the processor; and when the processordetermines that the third VXLAN packet is stored in the memory, theprocessor is further configured to decapsulate the third VXLAN packet.28. The first network device according to claim 26, wherein whenresidence time of a fourth VXLAN packet in the memory is greater than orequal to a first time threshold, the processor is further configured todetermine whether a value of a fourth sequence number is less than avalue of a sequence number comprised in another VXLAN packet stored inthe memory; and the processor is further configured to determine whetherthe value of the fourth sequence number is greater than a value of thefirst sequence number in the first VXLAN packet that has beendecapsulated by the processor, wherein the fourth VXLAN packet is aVXLAN packet received by the receiver on the first link or the secondlink, the fourth VXLAN packet comprises the fourth sequence number and afourth service packet, and the fourth sequence number indicates alocation of the fourth service packet in the plurality of servicepackets; and when the processor determines that the value of the fourthsequence number is less than the value of the sequence number comprisedin the another VXLAN packet stored in the memory, and the value of thefourth sequence number is greater than the value of the first sequencenumber in the first VXLAN packet that has been decapsulated by theprocessor, the processor is further configured to decapsulate the fourthVXLAN packet.
 29. The first network device according to claim 26,wherein when residence time of a fourth VXLAN packet in the memory isgreater than or equal to a first time threshold, the processor isfurther configured to determine whether a value of a fourth sequencenumber is greater than a value of a sequence number comprised in anotherVXLAN packet stored in the memory, wherein the fourth VXLAN packet is aVXLAN packet received by the receiver on the first link or the secondlink, the fourth VXLAN packet comprises the fourth sequence number and afourth service packet, and the fourth sequence number indicates alocation of the fourth service packet in the plurality of servicepackets; and when the processor determines that the value of the fourthsequence number is greater than the value of the sequence numbercomprised in the another VXLAN packet stored in the memory, theprocessor is further configured to: reset the residence time of thefourth VXLAN packet in the memory, and re-count the residence time ofthe fourth VXLAN packet in the memory.
 30. The first network deviceaccording to claim 26, wherein when residence time of a fourth VXLANpacket in the memory is greater than or equal to a first time threshold,the processor is further configured to determine whether a value of afourth sequence number is less than a value of a sequence numbercomprised in another VXLAN packet stored in the memory; and theprocessor is further configured to determine whether an absolute valueof a difference between the value of the fourth sequence number and avalue of the first sequence number in the first VXLAN packet that hasbeen decapsulated by the processor is greater than a first sequencenumber threshold, wherein the fourth VXLAN packet is a VXLAN packetreceived by the receiver on the first link or the second link, thefourth VXLAN packet comprises the fourth sequence number and a fourthservice packet, the fourth sequence number indicates a location of thefourth service packet in the plurality of service packets, and a rangeof the first sequence number threshold is [0.5N, N], wherein N indicatesan upper limit value of a sequence number in a VXLAN packet sent by thesecond network device; and when the processor determines that the valueof the fourth sequence number is less than the value of the sequencenumber comprised in the another VXLAN packet stored in the memory, andthe absolute value of the difference between the value of the fourthsequence number and the value of the first sequence number in the firstVXLAN packet that has been decapsulated by the processor is greater thanthe first sequence number threshold, the processor is further configuredto decapsulate the fourth VXLAN packet.
 31. The first network deviceaccording to claim 25, wherein the first VXLAN packet further comprisesan identifier of a first data flow, and the first data flow comprisesthe plurality of service packets.
 32. A second network device in avirtual extensible local area network (VXLAN), wherein the secondnetwork device comprises: a receiver, configured to receive a pluralityof service packets from a virtual machine (VM), wherein the plurality ofservice packets comprise a first service packet and a second servicepacket; a processor, configured to generate a first VXLAN packet basedon the first service packet, wherein the first VXLAN packet comprises afirst sequence number and the first service packet, and the firstsequence number indicates a location of the first service packet in theplurality of service packets; and a transmitter, configured to send thefirst VXLAN packet to a first network device in the VXLAN on a firstlink, the first network device connected to the second network devicethrough a VXLAN tunnel, and the VXLAN tunnel comprising the first linkand a second link; wherein the processor is further configured togenerate a second VXLAN packet based on the second service packet,wherein the second VXLAN packet comprises a second sequence number andthe second service packet, the second sequence number indicates alocation of the second service packet in the plurality of servicepackets, and the second service packet is a next service packet of thefirst service packet; and after the transmitter sends the first VXLANpacket to the first network device on the first link, the transmitter isfurther configured to send the second VXLAN packet to the first networkdevice on the second link.
 33. The second network device according toclaim 32, wherein the first VXLAN packet further comprises a VXLANheader, and the VXLAN header comprises the first sequence number. 34.The second network device according to claim 32, wherein the first VXLANpacket further comprises a generic network virtualization encapsulation(GENEVE) header, the GENEVE header comprises a sequence numbertype-length-value (TLV), and the sequence number TLV comprises the firstsequence number.
 35. The second network device according to claim 32,wherein the first VXLAN packet further comprises an identifier of afirst data flow, and the first data flow comprises the plurality ofservice packets.